import Vue from 'vue'
import VueRouter from 'vue-router'
import Laucher from '@/views/Laucher.vue'

Vue.use(VueRouter)
//全局路由配置， 重复路由不报错
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to){
    return VueRouterPush.call(this,to).catch(err => err)
}
const VueRouterReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace(to){
    return VueRouterReplace.call(this,to).catch(err => err)
}
const routes = [
  {
    //引导页面
    path: '/',
    name: 'Laucher',
    component: Laucher
  },
  {
    path: '/Main',
    name: 'Main',
    component: () => import('@/views/Main.vue'),
    redirect: '/Main/Category',
    children: [
      {
        path: '/Main/Category',
        name: 'Category',
        component: () => import('@/views/Category.vue')
      },
      {
        path: '/Main/Branding',
        name: 'Branding',
        component: () => import('@/views/Branding.vue')
      },
      {
        path:'/Main/SecKilling',
        name:'SecKilling',
        component:()=>import('@/views/SecKilling.vue')
      },
      {
        path:'/Main/FeatureRecommend',
        name:'FeatureRecommend',
        component:()=>import('@/views/FeatureRecommend.vue')
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
